<#include "*/component/Tags.ftl"/>
<@Title/>
<@ClassAnnotation>
@Service
@Transactional
</@ClassAnnotation>
public class ${clazz.name} implements ${clazz.parent.name} {

${'\t'}private ${entity.entityName}Assembler ${entity.objectName}Assembler = ${entity.entityName}Assembler.instance;

${'\t'}@Autowired
${'\t'}private ${entity.entityName}Repository ${entity.objectName}Repository;

${'\t'}@Override
${'\t'}public ${entity.entityName} create(${entity.entityName}CreateCommand command) {
${'\t'}${'\t'}${entity.entityName} ${entity.objectName} = ${entity.objectName}Assembler.domain(command);
${'\t'}${'\t'}${entity.entityName}SaveSpecification specification = new ${entity.entityName}SaveSpecification(${entity.objectName}Repository);
${'\t'}${'\t'}specification.isSatisfiedBy(${entity.objectName});
${'\t'}${'\t'}${entity.objectName}Repository.store(${entity.objectName});
${'\t'}${'\t'}return ${entity.objectName};
${'\t'}}

${'\t'}@Override
${'\t'}public ${entity.entityName} update(${entity.entityName}UpdateCommand command) {
${'\t'}${'\t'}${entity.entityName} ${entity.objectName} = ${entity.objectName}Repository.forceFind(command.getId());
${'\t'}${'\t'}${entity.objectName}Assembler.copy(${entity.objectName},command);
${'\t'}${'\t'}${entity.entityName}SaveSpecification specification = new ${entity.entityName}SaveSpecification(${entity.objectName}Repository);
${'\t'}${'\t'}specification.isSatisfiedBy(${entity.objectName});
${'\t'}${'\t'}${entity.objectName}Repository.store(${entity.objectName});
${'\t'}${'\t'}return ${entity.objectName};
${'\t'}}

${'\t'}@Override
${'\t'}public void delete(Long id) {
${'\t'}${'\t'}${entity.objectName}Repository.delete(id);
${'\t'}}

}
